# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mesa-demos
pkgver=8.5.0
pkgrel=0
pkgdesc="Mesa demos"
url="https://mesa3d.org"
arch="all"
license="custom"
makedepends="
	freeglut-dev
	glu-dev
	mesa-dev
	meson
	wayland-dev
	wayland-protocols
	"
subpackages="mesa-utils:_utils"
source="https://archive.mesa3d.org/demos/$pkgver/mesa-demos-$pkgver.tar.gz"
options="!check" # seemingly no way to run the tests

build() {
	# todo: figure out why the size went from ~8.4->34MB
	# (25 with lto), lots of binaries are ~150kb each and same-sized
	abuild-meson \
		-Dgles1=disabled \
		-Dwith-system-data-files=true \
		-Db_lto=true \
		. output
	meson compile -C output
}

package() {
	# already big, just pull in the other ones too.
	depends="mesa-utils"
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

check() {
	meson test -v --no-rebuild -C output
}

_utils() {
	pkgdesc="Essential mesa utilities"

	amove \
		usr/bin/eglinfo \
		usr/bin/glxinfo \
		usr/bin/glxgears
}

sha512sums="
f5da35fca9af1f9e1933d7fbd5c0899e494f30573faf3b3c1db5b1ff9e65d057dda5fcb4862c6fe65c3daf70063a778bea09b98a1e0561cfa84818be6a8712c2  mesa-demos-8.5.0.tar.gz
"
